home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / satan-1.1.1 / bin / tftp.satan < prev    next >
Text File  |  1996-04-24  |  1KB  |  68 lines

  1. #!/bin/sh
  2. #
  3. #  Usage: $0 target_host
  4. #
  5. #  Quick (well, relative; quickly written code, not a quick test) tftp
  6. # checker.
  7. #
  8. #  Connects to the host, tries to get the password file.  Takes a long
  9. # time to timeout...
  10. #
  11.  
  12. #
  13. #  Location of stuff:
  14.  
  15. . config/paths.sh
  16.  
  17. # need a target, eh?
  18. if $TEST $# -ne "1" ; then
  19.     $ECHO Usage: $0 target_host
  20.     exit 1
  21.     fi
  22.  
  23. # used in final output
  24. target=$1
  25. service=`$BASENAME $0 | $SED 's/\..*$//'`
  26. status="a"
  27.  
  28. # tmp and target file
  29. file=/etc/group
  30. TMP=./tmp.$$
  31.  
  32. #
  33. #   Do the dirty work -- check tftp for the localhost, if it was found;
  34. # this might take a bit, since tftp might have to time out.
  35. {
  36. $TFTP << _XXX_
  37. connect $target
  38. get $file $TMP
  39. quit
  40. _XXX_
  41. }  > /dev/null 2> /dev/null
  42.  
  43. if $TEST -s $TMP ; then
  44.     trustee="nobody@$target"
  45.     trusted="ANY@ANY"
  46.     service_output="TFTP file access"
  47.     text="tftp file read"
  48.     severity="nr"
  49.     $ECHO "$target|$service|$status|$severity|$trustee|$trusted|$service_output|$text"
  50.     # little trick; output it once, then again below, for both
  51.     # reading and writing.
  52.     text="tftp file write"
  53.     severity="nw"
  54. else
  55.     severity=""
  56.     trustee=""
  57.     trusted=""
  58.     service_output=""
  59.     text="tftp isn't running or is restricted"
  60.     fi
  61.  
  62. $ECHO "$target|$service|$status|$severity|$trustee|$trusted|$service_output|$text"
  63. $RM -f $TMP
  64.  
  65. exit 0
  66.  
  67. # end of script
  68.